﻿using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routes;

namespace Nop.Web.Infrastructure
{
    public class RouteProvider : IRouteProvider
    {
        private const string defaultController = "Nop.Web.Controllers";

        public void RegisterRoutes (RouteCollection routes)
        {
            // all product dealer
            routes.MapLocalizedRoute ("AllDealer",
                                      "alldealer",
                                      new {controller = "Catalog", action = "AllDealer"},
                                      new[] {defaultController});

            // benefit
            routes.MapLocalizedRoute ("Benefits",
                                      "benefits",
                                      new {controller = "Benefit", action = "Benefits"},
                                      new[] {defaultController});
            // billboard
            routes.MapLocalizedRoute ("Ranking",
                                      "ranking",
                                      new {controller = "Common", action = "Ranking"},
                                      new[] {defaultController});
            // trading floor
            routes.MapLocalizedRoute ("TradingFloor",
                                      "tradingfloor",
                                      new {controller = "TradingFloor", action = "TradingFloor"},
                                      new[] {defaultController});
            //home page
            routes.MapLocalizedRoute ("HomePage",
                                      "",
                                      new {controller = "Home", action = "Index"},
                                      new[] {defaultController});
            //install
            routes.MapRoute ("Installation",
                             "install",
                             new {controller = "Install", action = "Index"},
                             new[] {defaultController});

            //products
            routes.MapLocalizedRoute ("RecentlyViewedProducts",
                                      "recentlyviewedproducts/",
                                      new {controller = "Catalog", action = "RecentlyViewedProducts"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("RecentlyAddedProducts",
                                      "newproducts/",
                                      new {controller = "Catalog", action = "RecentlyAddedProducts"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("RecentlyAddedProductsRSS",
                                      "newproducts/rss",
                                      new {controller = "Catalog", action = "RecentlyAddedProductsRss"},
                                      new[] {defaultController});

            //comparing products
            routes.MapLocalizedRoute ("AddProductToCompare",
                                      "compareproducts/add/{productId}",
                                      new {controller = "Catalog", action = "AddProductToCompareList"},
                                      new {productId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CompareProducts",
                                      "compareproducts/",
                                      new {controller = "Catalog", action = "CompareProducts"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("RemoveProductFromCompareList",
                                      "compareproducts/remove/{productId}",
                                      new {controller = "Catalog", action = "RemoveProductFromCompareList"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ClearCompareList",
                                      "clearcomparelist/",
                                      new {controller = "Catalog", action = "ClearCompareList"},
                                      new[] {defaultController});

            //product email a friend
            routes.MapLocalizedRoute ("ProductEmailAFriend",
                                      "productemailafriend/{productId}",
                                      new {controller = "Catalog", action = "ProductEmailAFriend"},
                                      new {productId = @"\d+"},
                                      new[] {defaultController});

            //catalog
            routes.MapLocalizedRoute ("ManufacturerList",
                                      "manufacturer/all/",
                                      new {controller = "Catalog", action = "ManufacturerAll"},
                                      new[] {defaultController});
            //downloads
            routes.MapRoute ("GetSampleDownload",
                             "download/sample/{productvariantid}",
                             new {controller = "Download", action = "Sample"},
                             new {productvariantid = @"\d+"},
                             new[] {defaultController});
            routes.MapRoute ("GetDownload",
                             "download/getdownload/{opvid}/{agree}",
                             new {controller = "Download", action = "GetDownload", agree = UrlParameter.Optional},
                             new {opvid = new GuidConstraint (false)},
                             new[] {defaultController});
            routes.MapRoute ("GetLicense",
                             "download/getlicense/{opvid}/",
                             new {controller = "Download", action = "GetLicense"},
                             new {opvid = new GuidConstraint (false)},
                             new[] {defaultController});
            routes.MapLocalizedRoute ("DownloadUserAgreement",
                                      "customer/useragreement/{opvid}",
                                      new {controller = "Customer", action = "UserAgreement"},
                                      new {opvid = new GuidConstraint (false)},
                                      new[] {defaultController});

            //reviews
            routes.MapLocalizedRoute ("ProductReviews",
                                      "productreviews/{productId}",
                                      new {controller = "Catalog", action = "ProductReviews"},
                                      new[] {defaultController});
            routes.MapRoute ("SetProductReviewHelpfulness",
                             "setproductreviewhelpfulness",
                             new {controller = "Catalog", action = "SetProductReviewHelpfulness"},
                             new[] {defaultController});

            //back in stock notifications
            routes.MapLocalizedRoute ("BackInStockSubscribePopup",
                                      "backinstocksubscribe/{productVariantId}",
                                      new {controller = "Catalog", action = "BackInStockSubscribePopup"},
                                      new {productVariantId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("DeleteBackInStockSubscription",
                                      "backinstocksubscribe/delete/{subscriptionId}",
                                      new {controller = "Customer", action = "DeleteBackInStockSubscription"},
                                      new {subscriptionId = @"\d+"},
                                      new[] {defaultController});

            //login, register
            routes.MapLocalizedRoute ("Login",
                                      "login/",
                                      new {controller = "Customer", action = "Login"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("LoginCheckoutAsGuest",
                                      "login/checkoutasguest",
                                      new {controller = "Customer", action = "Login", checkoutAsGuest = true},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("Register",
                                      "register/",
                                      new {controller = "Customer", action = "Register"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("Logout",
                                      "logout/",
                                      new {controller = "Customer", action = "Logout"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("RegisterResult",
                                      "registerresult/{resultId}",
                                      new {controller = "Customer", action = "RegisterResult"},
                                      new {resultId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckUsernameAvailability",
                                      "customer/checkusernameavailability",
                                      new {controller = "Customer", action = "CheckUsernameAvailability"},
                                      new[] {defaultController});

            //shopping cart
            routes.MapLocalizedRoute ("ShoppingCart",
                                      "cart/",
                                      new {controller = "ShoppingCart", action = "Cart"},
                                      new[] {defaultController});
            //wishlist
            routes.MapLocalizedRoute ("Wishlist",
                                      "wishlist/{customerGuid}",
                                      new
                                          {
                                              controller = "ShoppingCart",
                                              action = "Wishlist",
                                              customerGuid = UrlParameter.Optional
                                          },
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("EmailWishlist",
                                      "emailwishlist",
                                      new {controller = "ShoppingCart", action = "EmailWishlist"},
                                      new[] {defaultController});
            //add product to cart (without any attributes and options)
            routes.MapLocalizedRoute ("AddProductToCart",
                                      "addproducttocart/{productId}/{shoppingCartTypeId}/{quantity}",
                                      new {controller = "ShoppingCart", action = "AddProductToCart"},
                                      new {productId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+"},
                                      new[] {defaultController});
            //add product variant to cart (with attributes and options)
            routes.MapLocalizedRoute ("AddProductVariantToCart",
                                      "addproductvarianttocart/{productVariantId}/{shoppingCartTypeId}",
                                      new {controller = "ShoppingCart", action = "AddProductVariantToCart"},
                                      new {productVariantId = @"\d+", shoppingCartTypeId = @"\d+"},
                                      new[] {defaultController});
            //product attributes with "upload file" type
            routes.MapLocalizedRoute ("UploadFileProductAttribute",
                                      "uploadfileproductattribute/{productVariantId}/{productAttributeId}",
                                      new {controller = "ShoppingCart", action = "UploadFileProductAttribute"},
                                      new {productVariantId = @"\d+", productAttributeId = @"\d+"},
                                      new[] {defaultController});

            //checkout
            routes.MapLocalizedRoute ("Checkout",
                                      "checkout/",
                                      new {controller = "Checkout", action = "Index"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutOnePage",
                                      "onepagecheckout/",
                                      new {controller = "Checkout", action = "OnePageCheckout"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutShippingAddress",
                                      "checkout/shippingaddress",
                                      new {controller = "Checkout", action = "ShippingAddress"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutSelectShippingAddress",
                                      "checkout/selectshippingaddress",
                                      new {controller = "Checkout", action = "SelectShippingAddress"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutBillingAddress",
                                      "checkout/billingaddress",
                                      new {controller = "Checkout", action = "BillingAddress"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutSelectBillingAddress",
                                      "checkout/selectbillingaddress",
                                      new {controller = "Checkout", action = "SelectBillingAddress"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutShippingMethod",
                                      "checkout/shippingmethod",
                                      new {controller = "Checkout", action = "ShippingMethod"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutPaymentMethod",
                                      "checkout/paymentmethod",
                                      new {controller = "Checkout", action = "PaymentMethod"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutPaymentInfo",
                                      "checkout/paymentinfo",
                                      new {controller = "Checkout", action = "PaymentInfo"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutConfirm",
                                      "checkout/confirm",
                                      new {controller = "Checkout", action = "Confirm"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CheckoutCompleted",
                                      "checkout/completed/{orderId}",
                                      new
                                          {
                                              controller = "Checkout",
                                              action = "Completed",
                                              orderId = UrlParameter.Optional
                                          },
                                      new {orderId = @"\d+"},
                                      new[] {defaultController});

            //orders
            routes.MapLocalizedRoute ("OrderDetails",
                                      "orderdetails/{orderId}",
                                      new {controller = "Order", action = "Details"},
                                      new {orderId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ShipmentDetails",
                                      "orderdetails/shipment/{shipmentId}",
                                      new {controller = "Order", action = "ShipmentDetails"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ReturnRequest",
                                      "returnrequest/{orderId}",
                                      new {controller = "ReturnRequest", action = "ReturnRequest"},
                                      new {orderId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ReOrder",
                                      "reorder/{orderId}",
                                      new {controller = "Order", action = "ReOrder"},
                                      new {orderId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("GetOrderPdfInvoice",
                                      "orderdetails/pdf/{orderId}",
                                      new {controller = "Order", action = "GetPdfInvoice"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PrintOrderDetails",
                                      "orderdetails/print/{orderId}",
                                      new {controller = "Order", action = "PrintOrderDetails"},
                                      new[] {defaultController});


            //contact us
            routes.MapLocalizedRoute ("ContactUs",
                                      "contactus",
                                      new {controller = "Common", action = "ContactUs"},
                                      new[] {defaultController});


            //store closed
            routes.MapLocalizedRoute ("StoreClosed",
                                      "storeclosed",
                                      new {controller = "Common", action = "StoreClosed"},
                                      new[] {defaultController});

            //passwordrecovery
            routes.MapLocalizedRoute ("PasswordRecovery",
                                      "passwordrecovery",
                                      new {controller = "Customer", action = "PasswordRecovery"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PasswordRecoveryConfirm",
                                      "passwordrecovery/confirm",
                                      new {controller = "Customer", action = "PasswordRecoveryConfirm"},
                                      new[] {defaultController});

            //newsletters
            routes.MapLocalizedRoute ("NewsletterActivation",
                                      "newsletter/subscriptionactivation/{token}/{active}",
                                      new {controller = "Newsletter", action = "SubscriptionActivation"},
                                      new {token = new GuidConstraint (false)},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("SubscribeNewsletter",
                                      "subscribenewsletter",
                                      new {controller = "Newsletter", action = "SubscribeNewsletter"},
                                      new[] {defaultController});



            //customer
            routes.MapLocalizedRoute ("CustomerMyAccount",
                                      "customer/myaccount",
                                      new {controller = "Customer", action = "MyAccount"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerInfo",
                                      "customer/info",
                                      new {controller = "Customer", action = "Info"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerAddresses",
                                      "customer/addresses",
                                      new {controller = "Customer", action = "Addresses"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerOrders",
                                      "customer/orders",
                                      new {controller = "Customer", action = "Orders"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerReturnRequests",
                                      "customer/returnrequests",
                                      new {controller = "Customer", action = "ReturnRequests"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerDownloadableProducts",
                                      "customer/downloadableproducts",
                                      new {controller = "Customer", action = "DownloadableProducts"},
                                      new[] {defaultController});


            routes.MapLocalizedRoute ("CustomerBackInStockSubscriptions",
                                      "customer/backinstocksubscriptions",
                                      new {controller = "Customer", action = "BackInStockSubscriptions"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerBackInStockSubscriptionsPaged",
                                      "customer/backinstocksubscriptions/{page}",
                                      new
                                          {
                                              controller = "Customer",
                                              action = "BackInStockSubscriptions",
                                              page = UrlParameter.Optional
                                          },
                                      new {page = @"\d+"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("CustomerRewardPoints",
                                      "customer/rewardpoints",
                                      new {controller = "Customer", action = "RewardPoints"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerChangePassword",
                                      "customer/changepassword",
                                      new {controller = "Customer", action = "ChangePassword"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerAvatar",
                                      "customer/avatar",
                                      new {controller = "Customer", action = "Avatar"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("AccountActivation",
                                      "customer/activation",
                                      new {controller = "Customer", action = "AccountActivation"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerProfile",
                                      "profile/{id}",
                                      new {controller = "Profile", action = "Index"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerProfilePaged",
                                      "profile/{id}/page/{page}",
                                      new {controller = "Profile", action = "Index"},
                                      new {id = @"\d+", page = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerForumSubscriptions",
                                      "customer/forumsubscriptions",
                                      new {controller = "Customer", action = "ForumSubscriptions"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerForumSubscriptionsPaged",
                                      "customer/forumsubscriptions/{page}",
                                      new
                                          {
                                              controller = "Customer",
                                              action = "ForumSubscriptions",
                                              page = UrlParameter.Optional
                                          },
                                      new {page = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("DeleteForumSubscription",
                                      "customer/forumsubscriptions/delete/{subscriptionId}",
                                      new {controller = "Customer", action = "DeleteForumSubscription"},
                                      new {subscriptionId = @"\d+"},
                                      new[] {defaultController});
            //addresses
            routes.MapLocalizedRoute ("CustomerAddressDelete",
                                      "customer/addressdelete/{addressId}",
                                      new {controller = "Customer", action = "AddressDelete"},
                                      new {addressId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerAddressEdit",
                                      "customer/addressedit/{addressId}",
                                      new {controller = "Customer", action = "AddressEdit"},
                                      new {addressId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("CustomerAddressAdd",
                                      "customer/addressadd",
                                      new {controller = "Customer", action = "AddressAdd"},
                                      new[] {defaultController});



            //blog
            routes.MapLocalizedRoute ("Blog",
                                      "blog",
                                      new {controller = "Blog", action = "List"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("BlogByTag",
                                      "blog/tag/{tag}",
                                      new {controller = "Blog", action = "BlogByTag"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("BlogByMonth",
                                      "blog/month/{month}",
                                      new {controller = "Blog", action = "BlogByMonth"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("BlogRSS",
                                      "blog/rss/{languageId}",
                                      new {controller = "Blog", action = "ListRss"},
                                      new {languageId = @"\d+"},
                                      new[] {defaultController});

            //forum
            routes.MapLocalizedRoute ("Boards",
                                      "boards",
                                      new {controller = "Boards", action = "Index"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ActiveDiscussions",
                                      "boards/activediscussions",
                                      new {controller = "Boards", action = "ActiveDiscussions"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ActiveDiscussionsRSS",
                                      "boards/activediscussionsrss",
                                      new {controller = "Boards", action = "ActiveDiscussionsRSS"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PostEdit",
                                      "boards/postedit/{id}",
                                      new {controller = "Boards", action = "PostEdit"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PostDelete",
                                      "boards/postdelete/{id}",
                                      new {controller = "Boards", action = "PostDelete"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PostCreate",
                                      "boards/postcreate/{id}",
                                      new {controller = "Boards", action = "PostCreate"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("PostCreateQuote",
                                      "boards/postcreate/{id}/{quote}",
                                      new {controller = "Boards", action = "PostCreate"},
                                      new {id = @"\d+", quote = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicEdit",
                                      "boards/topicedit/{id}",
                                      new {controller = "Boards", action = "TopicEdit"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicDelete",
                                      "boards/topicdelete/{id}",
                                      new {controller = "Boards", action = "TopicDelete"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicCreate",
                                      "boards/topiccreate/{id}",
                                      new {controller = "Boards", action = "TopicCreate"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicMove",
                                      "boards/topicmove/{id}",
                                      new {controller = "Boards", action = "TopicMove"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicWatch",
                                      "boards/topicwatch/{id}",
                                      new {controller = "Boards", action = "TopicWatch"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicSlug",
                                      "boards/topic/{id}/{slug}",
                                      new {controller = "Boards", action = "Topic", slug = UrlParameter.Optional},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicSlugPaged",
                                      "boards/topic/{id}/{slug}/page/{page}",
                                      new
                                          {
                                              controller = "Boards",
                                              action = "Topic",
                                              slug = UrlParameter.Optional,
                                              page = UrlParameter.Optional
                                          },
                                      new {id = @"\d+", page = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ForumWatch",
                                      "boards/forumwatch/{id}",
                                      new {controller = "Boards", action = "ForumWatch"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ForumRSS",
                                      "boards/forumrss/{id}",
                                      new {controller = "Boards", action = "ForumRSS"},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ForumSlug",
                                      "boards/forum/{id}/{slug}",
                                      new {controller = "Boards", action = "Forum", slug = UrlParameter.Optional},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ForumSlugPaged",
                                      "boards/forum/{id}/{slug}/page/{page}",
                                      new
                                          {
                                              controller = "Boards",
                                              action = "Forum",
                                              slug = UrlParameter.Optional,
                                              page = UrlParameter.Optional
                                          },
                                      new {id = @"\d+", page = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ForumGroupSlug",
                                      "boards/forumgroup/{id}/{slug}",
                                      new {controller = "Boards", action = "ForumGroup", slug = UrlParameter.Optional},
                                      new {id = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("Search",
                                      "boards/search",
                                      new {controller = "Boards", action = "Search"},
                                      new[] {defaultController});


            //private messages
            routes.MapLocalizedRoute ("PrivateMessages",
                                      "privatemessages/{tab}",
                                      new
                                          {
                                              controller = "PrivateMessages",
                                              action = "Index",
                                              tab = UrlParameter.Optional
                                          },
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("PrivateMessagesPaged",
                                      "privatemessages/{tab}/page/{page}",
                                      new
                                          {
                                              controller = "PrivateMessages",
                                              action = "Index",
                                              tab = UrlParameter.Optional
                                          },
                                      new {page = @"\d+"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("PrivateMessagesInbox",
                                      "inboxupdate",
                                      new {controller = "PrivateMessages", action = "InboxUpdate"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("PrivateMessagesSent",
                                      "sentupdate",
                                      new {controller = "PrivateMessages", action = "SentUpdate"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("SendPM",
                                      "sendpm/{toCustomerId}",
                                      new {controller = "PrivateMessages", action = "SendPM"},
                                      new {toCustomerId = @"\d+"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("SendPMReply",
                                      "sendpm/{toCustomerId}/{replyToMessageId}",
                                      new {controller = "PrivateMessages", action = "SendPM"},
                                      new {toCustomerId = @"\d+", replyToMessageId = @"\d+"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("ViewPM",
                                      "viewpm/{privateMessageId}",
                                      new {controller = "PrivateMessages", action = "ViewPM"},
                                      new {privateMessageId = @"\d+"},
                                      new[] {defaultController});

            routes.MapLocalizedRoute ("DeletePM",
                                      "deletepm/{privateMessageId}",
                                      new {controller = "PrivateMessages", action = "DeletePM"},
                                      new {privateMessageId = @"\d+"},
                                      new[] {defaultController});

            //news
            routes.MapLocalizedRoute ("NewsArchive",
                                      "news",
                                      new {controller = "News", action = "List"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("NewsRSS",
                                      "news/rss/{languageId}",
                                      new {controller = "News", action = "ListRss"},
                                      new {languageId = @"\d+"},
                                      new[] {defaultController});

            //topics
            routes.MapLocalizedRoute ("Topic",
                                      "t/{SystemName}",
                                      new {controller = "Topic", action = "TopicDetails"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicPopup",
                                      "t-popup/{SystemName}",
                                      new {controller = "Topic", action = "TopicDetailsPopup"},
                                      new[] {defaultController});
            //sitemaps
            routes.MapLocalizedRoute ("Sitemap",
                                      "sitemap",
                                      new {controller = "Common", action = "Sitemap"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("SitemapSEO",
                                      "sitemapseo",
                                      new {controller = "Common", action = "SitemapSeo"},
                                      new[] {defaultController});

            //product tags
            routes.MapLocalizedRoute ("ProductsByTag",
                                      "producttag/{productTagId}/{SeName}",
                                      new
                                          {
                                              controller = "Catalog",
                                              action = "ProductsByTag",
                                              SeName = UrlParameter.Optional
                                          },
                                      new {productTagId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ProductTagsAll",
                                      "producttag/all/",
                                      new {controller = "Catalog", action = "ProductTagsAll"},
                                      new[] {defaultController});

            #region Product tag URL fix

            //in versions 2.00-2.65 we had typo in producttag URLs ("productag" instead of "producttag")
            //we should support old "buggy" URLs
            routes.MapLocalizedRoute ("ProductsByTag_Fix1",
                                      "productag/{productTagId}/{SeName}",
                                      new
                                          {
                                              controller = "BackwardCompatibility2X",
                                              action = "RedirectProductsByTag",
                                              SeName = UrlParameter.Optional
                                          },
                                      new {productTagId = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ProductTagsAll_Fix1",
                                      "productag/all/",
                                      new {controller = "BackwardCompatibility2X", action = "RedirectProductTagsAll"},
                                      new[] {defaultController});

            #endregion

            //product search
            routes.MapLocalizedRoute ("ProductSearch",
                                      "search/",
                                      new {controller = "Catalog", action = "Search"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ProductSearchAutoComplete",
                                      "catalog/searchtermautocomplete",
                                      new {controller = "Catalog", action = "SearchTermAutoComplete"},
                                      new[] {defaultController});

            //config
            routes.MapLocalizedRoute ("Config",
                                      "config",
                                      new {controller = "Common", action = "Config"},
                                      new[] {defaultController});

            //some AJAX links
            routes.MapRoute ("GetStatesByCountryId",
                             "country/getstatesbycountryid/",
                             new {controller = "Country", action = "GetStatesByCountryId"},
                             new[] {defaultController});
            routes.MapRoute ("GetDistrictsByStateProvinceId",
                             "state/getdistrictsbystateid/",
                             new {controller = "StateProvince", action = "GetDistrictsByStateProvinceId"},
                             new[] {defaultController});
            routes.MapLocalizedRoute ("ChangeDevice",
                                      "changedevice/{dontusemobileversion}",
                                      new {controller = "Common", action = "ChangeDevice"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ChangeCurrency",
                                      "changecurrency/{customercurrency}",
                                      new {controller = "Common", action = "CurrencySelected"},
                                      new {customercurrency = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ChangeLanguage",
                                      "changelanguage/{langid}",
                                      new {controller = "Common", action = "SetLanguage"},
                                      new {langid = @"\d+"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("ChangeTaxType",
                                      "changetaxtype/{customertaxtype}",
                                      new {controller = "Common", action = "TaxTypeSelected"},
                                      new {customertaxtype = @"\d+"},
                                      new[] {defaultController});
            routes.MapRoute ("EuCookieLawAccept",
                             "eucookielawaccept",
                             new {controller = "Common", action = "EuCookieLawAccept"},
                             new[] {defaultController});
            routes.MapLocalizedRoute ("PollVote",
                                      "poll/vote",
                                      new {controller = "Poll", action = "Vote"},
                                      new[] {defaultController});
            routes.MapLocalizedRoute ("TopicAuthenticate",
                                      "topic/authenticate",
                                      new {controller = "Topic", action = "Authenticate"},
                                      new[] {defaultController});
            //robots.txt
            routes.MapRoute ("robots.txt",
                             "robots.txt",
                             new {controller = "Common", action = "RobotsTextFile"},
                             new[] {defaultController});
        }

        public int Priority
        {
            get { return 0; }
        }
    }
}
